//-------------------------------------------放大镜--------------------------------------

			var asmall = document.querySelectorAll('.small');
			var omiddle = document.querySelector('.middle');
			var oBox = document.getElementById("box");
			var oFilter = document.getElementById("filter");
			var max = document.getElementById("max");
			var maxImg = document.getElementById("maxImg");

			for(var i=0;i<asmall.length;i++){
				asmall[i].index = i
				asmall[i].onmouseover = function(){
					var oimg = asmall[this.index].getAttribute('src');				
					omiddle.setAttribute('src','imgs/'+pageId+'/'+pageId+'-'+(this.index+1)+'-large.jpg');
					maxImg.setAttribute('src','imgs/'+pageId+'/'+pageId+'-'+(this.index+1)+'-large.jpg');
				}
			}

			//进入生成放大镜
			oBox.onmouseenter=function(){
				oFilter.style.display="block";
				max.style.display="block";
				this.onmousemove = function(e){
				var e = e||event;//兼容浏览器
				var l = e.clientX -oBox.parentElement.offsetLeft-oFilter.offsetWidth/2; 
				var t = e.clientY - oBox.parentElement.offsetTop-oFilter.offsetHeight/2; 




		//让鼠标在放大器的中心
		 /*
		        filter,它的left是鼠标位置的横坐标长度(e.clientX)减去
		        它最外层父元素的左边距(oBox.parentElement.offsetLeft)以及
		        这个filter盒子宽度的一半(filter.offsetWidth/2);filter的top和left原理类似
		*/
		//filter盒子距离box这个父元素的最大left(maxLeft)和top值(maxTop)
		        var maxLeft=oBox.offsetWidth-oFilter.offsetWidth;
		        var maxTop=oBox.offsetHeight-oFilter.offsetHeight;
		        
		          l=l>=maxLeft ? maxLeft:(l<=0? 0:l);
			      // t=t>=maxTop ? maxTop:(t<=0? 0:t);
			      t=t<=0 ? 0:(t>=maxTop? maxTop:t);
		        oFilter.style.left=l+"px";
		        oFilter.style.top=t+"px";

		        //右边大图的left和top:left/maxLeft和top/maxTop求得的是比例
		        var bigImgLef=(l/maxLeft)*(maxImg.offsetWidth-max.offsetWidth);
		        var bigImgTop=(t/maxTop)*(maxImg.offsetHeight-max.offsetHeight);

		        //大图移动时的坐标
		        maxImg.style.left=-bigImgLef+"px";
		        maxImg.style.top=-bigImgTop+"px";

				}



			}
			//离开消失放大镜
			oBox.onmouseleave=function(){
				oFilter.style.display="none";
				max.style.display="none";
			}